package com.eiss.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.eiss.common.utils.poi.ExcelUtil;
import com.eiss.domain.Entily.Express;
import com.eiss.service.IExpressService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.eiss.common.annotation.Log;
import com.eiss.common.core.controller.BaseController;
import com.eiss.common.core.domain.AjaxResult;
import com.eiss.common.enums.BusinessType;
import com.eiss.common.core.page.TableDataInfo;

/**
 * 快递信息管理Controller
 * 
 * @author ruoyi
 * @date 2025-02-06
 */
@RestController
@RequestMapping("/express/express")
public class ExpressController extends BaseController
{
    @Autowired
    private IExpressService expressService;

    /**
     * 查询快递信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('express:express:list')")
    @GetMapping("/list")
    public TableDataInfo list(Express express)
    {
        startPage();
        List<Express> list = expressService.selectExpressList(express);
        return getDataTable(list);
    }

    /**
     * 导出快递信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('express:express:export')")
    @Log(title = "快递信息管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Express express)
    {
        List<Express> list = expressService.selectExpressList(express);
        ExcelUtil<Express> util = new ExcelUtil<Express>(Express.class);
        util.exportExcel(response, list, "快递信息管理数据");
    }

    /**
     * 获取快递信息管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('express:express:query')")
    @GetMapping(value = "/{ExpressNumber}")
    public AjaxResult getInfo(@PathVariable("ExpressNumber") String ExpressNumber)
    {
        return success(expressService.selectExpressByExpressNumber(ExpressNumber));
    }

    /**
     * 新增快递信息管理
     */
    @PreAuthorize("@ss.hasPermi('express:express:add')")
    @Log(title = "快递信息管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Express express)
    {
        return toAjax(expressService.insertExpress(express));
    }

    /**
     * 修改快递信息管理
     */
    @PreAuthorize("@ss.hasPermi('express:express:edit')")
    @Log(title = "快递信息管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Express express)
    {
        return toAjax(expressService.updateExpress(express));
    }

    /**
     * 删除快递信息管理
     */
    @PreAuthorize("@ss.hasPermi('express:express:remove')")
    @Log(title = "快递信息管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ExpressNumbers}")
    public AjaxResult remove(@PathVariable String[] ExpressNumbers)
    {
        return toAjax(expressService.deleteExpressByExpressNumbers(ExpressNumbers));
    }
}
